//
//  Tunings+Harmonic.swift
//  AudioKitSynthOne
//
//  Created by Marcus Hobbs on 5/20/18.
//  Copyright © 2018 AudioKit. All rights reserved.
//

import Foundation

extension Tunings {

    // pitch is log2(frequency)
    public class func approximateHarmonicFromPitch(_ pitch: Double) -> String {
        
        let harmonics = [
            "0.000": "1",
            "0.001": "1/1023",
            "0.002": "1/2045",
            "0.003": "1/511",
            "0.004": "1/1021",
            "0.005": "1/2041",
            "0.006": "1/255",
            "0.007": "1/1019",
            "0.008": "1/509",
            "0.009": "1/2035",
            "0.010": "1/1017",
            "0.011": "1/127",
            "0.012": "1/2031",
            "0.013": "1/1015",
            "0.014": "1/507",
            "0.015": "1035",
            "0.016": "1/1013",
            "0.017": "1/253",
            "0.018": "1/1011",
            "0.019": "1/2021",
            "0.020": "1/505",
            "0.021": "1/1009",
            "0.022": "65",
            "0.023": "1/63",
            "0.024": "1/1007",
            "0.025": "521",
            "0.026": "1/503",
            "0.027": "1/1005",
            "0.028": "1/251",
            "0.029": "1045",
            "0.030": "1/1003",
            "0.031": "1/501",
            "0.032": "1047",
            "0.033": "131",
            "0.034": "1/125",
            "0.035": "1049",
            "0.036": "525",
            "0.037": "1/499",
            "0.038": "1051",
            "0.039": "263",
            "0.040": "1/249",
            "0.041": "1/995",
            "0.042": "527",
            "0.043": "1/497",
            "0.044": "33",
            "0.045": "1/1985",
            "0.046": "1/31",
            "0.047": "529",
            "0.048": "1059",
            "0.049": "1/495",
            "0.050": "265",
            "0.051": "1061",
            "0.052": "1/247",
            "0.053": "531",
            "0.054": "1063",
            "0.055": "133",
            "0.056": "1/985",
            "0.057": "1/123",
            "0.058": "533",
            "0.059": "1/983",
            "0.060": "1/491",
            "0.061": "267",
            "0.062": "1/981",
            "0.063": "1/245",
            "0.064": "1/1959",
            "0.065": "1/979",
            "0.066": "67",
            "0.067": "1073",
            "0.068": "1/977",
            "0.069": "1/61",
            "0.070": "1075",
            "0.071": "269",
            "0.072": "1/487",
            "0.073": "1077",
            "0.074": "539",
            "0.075": "1/243",
            "0.076": "1/1943",
            "0.077": "135",
            "0.078": "1/485",
            "0.079": "541",
            "0.080": "1/969",
            "0.081": "1/121",
            "0.082": "271",
            "0.083": "1/967",
            "0.084": "1/483",
            "0.085": "543",
            "0.086": "1/965",
            "0.087": "17",
            "0.088": "1/1927",
            "0.089": "1/963",
            "0.090": "1/481",
            "0.091": "1091",
            "0.092": "1/961",
            "0.093": "1/15",
            "0.094": "1093",
            "0.095": "547",
            "0.096": "1/479",
            "0.097": "1095",
            "0.098": "137",
            "0.099": "1/239",
            "0.100": "1/1911",
            "0.101": "549",
            "0.102": "1/477",
            "0.103": "275",
            "0.104": "1/953",
            "0.105": "1/119",
            "0.106": "551",
            "0.107": "1/951",
            "0.108": "1/475",
            "0.109": "69",
            "0.110": "1/949",
            "0.111": "1/237",
            "0.112": "1107",
            "0.113": "1/947",
            "0.114": "277",
            "0.115": "1109",
            "0.116": "555",
            "0.117": "1/59",
            "0.118": "1111",
            "0.119": "139",
            "0.120": "1/471",
            "0.121": "1/1883",
            "0.122": "557",
            "0.123": "1/235",
            "0.124": "279",
            "0.125": "1/939",
            "0.126": "1/1877",
            "0.127": "1/469",
            "0.128": "1/937",
            "0.129": "35",
            "0.130": "1/117",
            "0.131": "1/935",
            "0.132": "561",
            "0.133": "1/467",
            "0.134": "281",
            "0.135": "1/1865",
            "0.136": "1/233",
            "0.137": "563",
            "0.138": "1127",
            "0.139": "1/465",
            "0.140": "141",
            "0.141": "1129",
            "0.142": "1/29",
            "0.143": "1131",
            "0.144": "1/927",
            "0.145": "283",
            "0.146": "1133",
            "0.147": "567",
            "0.148": "1/231",
            "0.149": "1/1847",
            "0.150": "71",
            "0.151": "1/461",
            "0.152": "569",
            "0.153": "1/921",
            "0.154": "1139",
            "0.155": "1/115",
            "0.156": "1/919",
            "0.157": "571",
            "0.158": "1/459",
            "0.159": "1/917",
            "0.160": "143",
            "0.161": "1/229",
            "0.162": "573",
            "0.163": "1/1829",
            "0.164": "1/457",
            "0.165": "287",
            "0.166": "1/913",
            "0.167": "1/57",
            "0.168": "1/1823",
            "0.169": "1/911",
            "0.170": "9",
            "0.171": "1153",
            "0.172": "577",
            "0.173": "1/227",
            "0.174": "1155",
            "0.175": "289",
            "0.176": "1157",
            "0.177": "1/453",
            "0.178": "1/905",
            "0.179": "1159",
            "0.180": "1/113",
            "0.181": "1/903",
            "0.182": "581",
            "0.183": "1/451",
            "0.184": "1163",
            "0.185": "291",
            "0.186": "1/225",
            "0.187": "583",
            "0.188": "1/899",
            "0.189": "1/449",
            "0.190": "73",
            "0.191": "1/897",
            "0.192": "585",
            "0.193": "1/7",
            "0.194": "1/895",
            "0.195": "293",
            "0.196": "1/447",
            "0.197": "587",
            "0.198": "1175",
            "0.199": "1/223",
            "0.200": "147",
            "0.201": "1/891",
            "0.202": "1/445",
            "0.203": "1179",
            "0.204": "1/889",
            "0.205": "295",
            "0.206": "1/111",
            "0.207": "591",
            "0.208": "1183",
            "0.209": "37",
            "0.210": "1/885",
            "0.211": "1185",
            "0.212": "1/221",
            "0.213": "1187",
            "0.214": "297",
            "0.215": "1/441",
            "0.216": "1189",
            "0.217": "595",
            "0.218": "1191",
            "0.219": "1/55",
            "0.220": "1/879",
            "0.221": "1/1757",
            "0.222": "1/439",
            "0.223": "1195",
            "0.224": "299",
            "0.225": "1/219",
            "0.226": "599",
            "0.227": "1/875",
            "0.228": "1199",
            "0.229": "75",
            "0.230": "1/873",
            "0.231": "601",
            "0.232": "1/109",
            "0.233": "1/871",
            "0.234": "301",
            "0.235": "1/435",
            "0.236": "603",
            "0.237": "1/869",
            "0.238": "151",
            "0.239": "1/1735",
            "0.240": "1/867",
            "0.241": "605",
            "0.242": "1/433",
            "0.243": "303",
            "0.244": "1213",
            "0.245": "1/27",
            "0.246": "607",
            "0.247": "1/863",
            "0.248": "19",
            "0.249": "1217",
            "0.250": "609",
            "0.251": "1219",
            "0.252": "1/215",
            "0.253": "305",
            "0.254": "1221",
            "0.255": "1/429",
            "0.256": "1223",
            "0.257": "153",
            "0.258": "1/1713",
            "0.259": "1/107",
            "0.260": "613",
            "0.261": "1227",
            "0.262": "307",
            "0.263": "1229",
            "0.264": "615",
            "0.265": "1/213",
            "0.266": "1231",
            "0.267": "77",
            "0.268": "1233",
            "0.269": "1/425",
            "0.270": "1/849",
            "0.271": "309",
            "0.272": "1/53",
            "0.273": "1237",
            "0.274": "619",
            "0.275": "1/423",
            "0.276": "155",
            "0.277": "1/845",
            "0.278": "621",
            "0.279": "1/211",
            "0.280": "1243",
            "0.281": "311",
            "0.282": "1/421",
            "0.283": "623",
            "0.284": "1/841",
            "0.285": "39",
            "0.286": "1/105",
            "0.287": "1/839",
            "0.288": "625",
            "0.289": "1/419",
            "0.290": "313",
            "0.291": "1/837",
            "0.292": "627",
            "0.293": "1/209",
            "0.294": "1/835",
            "0.295": "157",
            "0.296": "1/417",
            "0.297": "629",
            "0.298": "1/833",
            "0.299": "315",
            "0.300": "1/13",
            "0.301": "631",
            "0.302": "1/1661",
            "0.303": "1/415",
            "0.304": "79",
            "0.305": "1/829",
            "0.306": "633",
            "0.307": "1/207",
            "0.308": "317",
            "0.309": "1269",
            "0.310": "1/413",
            "0.311": "635",
            "0.312": "1/825",
            "0.313": "1/103",
            "0.314": "1273",
            "0.315": "637",
            "0.316": "1275",
            "0.317": "319",
            "0.318": "1/1643",
            "0.319": "1/821",
            "0.320": "639",
            "0.321": "1/205",
            "0.322": "5",
            "0.323": "1281",
            "0.324": "1/409",
            "0.325": "1283",
            "0.326": "321",
            "0.327": "1/1633",
            "0.328": "1/51",
            "0.329": "643",
            "0.330": "1287",
            "0.331": "161",
            "0.332": "1289",
            "0.333": "645",
            "0.334": "1291",
            "0.335": "1/203",
            "0.336": "1/811",
            "0.337": "1293",
            "0.338": "1/405",
            "0.339": "1295",
            "0.340": "81",
            "0.341": "1297",
            "0.342": "1/101",
            "0.343": "1299",
            "0.344": "325",
            "0.345": "1/403",
            "0.346": "1/1611",
            "0.347": "651",
            "0.348": "1303",
            "0.349": "163",
            "0.350": "1305",
            "0.351": "653",
            "0.352": "1307",
            "0.353": "327",
            "0.354": "1/801",
            "0.355": "655",
            "0.356": "1/25",
            "0.357": "1/1599",
            "0.358": "41",
            "0.359": "1313",
            "0.360": "1/399",
            "0.361": "1315",
            "0.362": "329",
            "0.363": "1/199",
            "0.364": "659",
            "0.365": "1/795",
            "0.366": "165",
            "0.367": "1/397",
            "0.368": "1/1587",
            "0.369": "661",
            "0.370": "1323",
            "0.371": "1/99",
            "0.372": "1/791",
            "0.373": "663",
            "0.374": "1/395",
            "0.375": "83",
            "0.376": "1/789",
            "0.377": "665",
            "0.378": "1/197",
            "0.379": "333",
            "0.380": "1/787",
            "0.381": "1/1573",
            "0.382": "1/393",
            "0.383": "1/785",
            "0.384": "167",
            "0.385": "1/49",
            "0.386": "669",
            "0.387": "1/783",
            "0.388": "335",
            "0.389": "1/391",
            "0.390": "671",
            "0.391": "1/781",
            "0.392": "21",
            "0.393": "1/195",
            "0.394": "673",
            "0.395": "1/779",
            "0.396": "1/389",
            "0.397": "337",
            "0.398": "1/777",
            "0.399": "675",
            "0.400": "1/97",
            "0.401": "169",
            "0.402": "1/775",
            "0.403": "677",
            "0.404": "1/387",
            "0.405": "339",
            "0.406": "1/773",
            "0.407": "679",
            "0.408": "1/193",
            "0.409": "85",
            "0.410": "1361",
            "0.411": "1/385",
            "0.412": "681",
            "0.413": "1/769",
            "0.414": "341",
            "0.415": "1/3",
            "0.416": "683",
            "0.417": "1/767",
            "0.418": "171",
            "0.419": "1/383",
            "0.420": "685",
            "0.421": "1/765",
            "0.422": "343",
            "0.423": "1/191",
            "0.424": "687",
            "0.425": "1375",
            "0.426": "43",
            "0.427": "1377",
            "0.428": "689",
            "0.429": "1379",
            "0.430": "1/95",
            "0.431": "1381",
            "0.432": "1/759",
            "0.433": "691",
            "0.434": "1/379",
            "0.435": "173",
            "0.436": "1/757",
            "0.437": "693",
            "0.438": "1/189",
            "0.439": "347",
            "0.440": "1/755",
            "0.441": "695",
            "0.442": "1/377",
            "0.443": "87",
            "0.444": "1393",
            "0.445": "1/47",
            "0.446": "1395",
            "0.447": "349",
            "0.448": "1397",
            "0.449": "1/375",
            "0.450": "1399",
            "0.451": "175",
            "0.452": "1401",
            "0.453": "1/187",
            "0.454": "1403",
            "0.455": "351",
            "0.456": "1405",
            "0.457": "1/373",
            "0.458": "1407",
            "0.459": "11",
            "0.460": "1409",
            "0.461": "1/93",
            "0.462": "1/1487",
            "0.463": "1/743",
            "0.464": "353",
            "0.465": "1/371",
            "0.466": "707",
            "0.467": "1/741",
            "0.468": "177",
            "0.469": "1/185",
            "0.470": "709",
            "0.471": "1/739",
            "0.472": "355",
            "0.473": "1/369",
            "0.474": "711",
            "0.475": "1423",
            "0.476": "1/23",
            "0.477": "1425",
            "0.478": "713",
            "0.479": "1427",
            "0.480": "357",
            "0.481": "1429",
            "0.482": "715",
            "0.483": "1431",
            "0.484": "179",
            "0.485": "1433",
            "0.486": "717",
            "0.487": "1435",
            "0.488": "359",
            "0.489": "1437",
            "0.490": "719",
            "0.491": "1439",
            "0.492": "45",
            "0.493": "1441",
            "0.494": "721",
            "0.495": "1443",
            "0.496": "361",
            "0.497": "1445",
            "0.498": "723",
            "0.499": "1447",
            "0.500": "181",
            "0.501": "1/1447",
            "0.502": "1/723",
            "0.503": "1/1445",
            "0.504": "1/361",
            "0.505": "1/1443",
            "0.506": "1/721",
            "0.507": "1/1441",
            "0.508": "1/45",
            "0.509": "1/1439",
            "0.510": "1/719",
            "0.511": "1/1437",
            "0.512": "1/359",
            "0.513": "1/1435",
            "0.514": "1/717",
            "0.515": "1/1433",
            "0.516": "1/179",
            "0.517": "1/1431",
            "0.518": "1/715",
            "0.519": "1/1429",
            "0.520": "1/357",
            "0.521": "1/1427",
            "0.522": "1/713",
            "0.523": "1/1425",
            "0.524": "23",
            "0.525": "1/1423",
            "0.526": "1/711",
            "0.527": "369",
            "0.528": "1/355",
            "0.529": "739",
            "0.530": "1/709",
            "0.531": "185",
            "0.532": "1/177",
            "0.533": "741",
            "0.534": "1/707",
            "0.535": "371",
            "0.536": "1/353",
            "0.537": "743",
            "0.538": "1487",
            "0.539": "93",
            "0.540": "1/1409",
            "0.541": "1/11",
            "0.542": "1/1407",
            "0.543": "373",
            "0.544": "1/1405",
            "0.545": "1/351",
            "0.546": "1/1403",
            "0.547": "187",
            "0.548": "1/1401",
            "0.549": "1/175",
            "0.550": "1/1399",
            "0.551": "375",
            "0.552": "1/1397",
            "0.553": "1/349",
            "0.554": "1/1395",
            "0.555": "47",
            "0.556": "1/1393",
            "0.557": "1/87",
            "0.558": "377",
            "0.559": "1/695",
            "0.560": "755",
            "0.561": "1/347",
            "0.562": "189",
            "0.563": "1/693",
            "0.564": "757",
            "0.565": "1/173",
            "0.566": "379",
            "0.567": "1/691",
            "0.568": "759",
            "0.569": "1/1381",
            "0.570": "95",
            "0.571": "1/1379",
            "0.572": "1/689",
            "0.573": "1/1377",
            "0.574": "1/43",
            "0.575": "1/1375",
            "0.576": "1/687",
            "0.577": "191",
            "0.578": "1/343",
            "0.579": "765",
            "0.580": "1/685",
            "0.581": "383",
            "0.582": "1/171",
            "0.583": "767",
            "0.584": "1/683",
            "0.585": "3",
            "0.586": "1/341",
            "0.587": "769",
            "0.588": "1/681",
            "0.589": "385",
            "0.590": "1/1361",
            "0.591": "1/85",
            "0.592": "193",
            "0.593": "1/679",
            "0.594": "773",
            "0.595": "1/339",
            "0.596": "387",
            "0.597": "1/677",
            "0.598": "775",
            "0.599": "1/169",
            "0.600": "97",
            "0.601": "1/675",
            "0.602": "777",
            "0.603": "1/337",
            "0.604": "389",
            "0.605": "779",
            "0.606": "1/673",
            "0.607": "195",
            "0.608": "1/21",
            "0.609": "781",
            "0.610": "1/671",
            "0.611": "391",
            "0.612": "1/335",
            "0.613": "783",
            "0.614": "1/669",
            "0.615": "49",
            "0.616": "1/167",
            "0.617": "785",
            "0.618": "393",
            "0.619": "1573",
            "0.620": "787",
            "0.621": "1/333",
            "0.622": "197",
            "0.623": "1/665",
            "0.624": "789",
            "0.625": "1/83",
            "0.626": "395",
            "0.627": "1/663",
            "0.628": "791",
            "0.629": "99",
            "0.630": "1/1323",
            "0.631": "1/661",
            "0.632": "1587",
            "0.633": "397",
            "0.634": "1/165",
            "0.635": "795",
            "0.636": "1/659",
            "0.637": "199",
            "0.638": "1/329",
            "0.639": "1/1315",
            "0.640": "399",
            "0.641": "1/1313",
            "0.642": "1/41",
            "0.643": "1599",
            "0.644": "25",
            "0.645": "1/655",
            "0.646": "801",
            "0.647": "1/327",
            "0.648": "1/1307",
            "0.649": "1/653",
            "0.650": "1/1305",
            "0.651": "1/163",
            "0.652": "1/1303",
            "0.653": "1/651",
            "0.654": "1611",
            "0.655": "403",
            "0.656": "1/325",
            "0.657": "1/1299",
            "0.658": "101",
            "0.659": "1/1297",
            "0.660": "1/81",
            "0.661": "1/1295",
            "0.662": "405",
            "0.663": "1/1293",
            "0.664": "811",
            "0.665": "203",
            "0.666": "1/1291",
            "0.667": "1/645",
            "0.668": "1/1289",
            "0.669": "1/161",
            "0.670": "1/1287",
            "0.671": "1/643",
            "0.672": "51",
            "0.673": "1633",
            "0.674": "1/321",
            "0.675": "1/1283",
            "0.676": "409",
            "0.677": "1/1281",
            "0.678": "1/5",
            "0.679": "205",
            "0.680": "1/639",
            "0.681": "821",
            "0.682": "1643",
            "0.683": "1/319",
            "0.684": "1/1275",
            "0.685": "1/637",
            "0.686": "1/1273",
            "0.687": "103",
            "0.688": "825",
            "0.689": "1/635",
            "0.690": "413",
            "0.691": "1/1269",
            "0.692": "1/317",
            "0.693": "207",
            "0.694": "1/633",
            "0.695": "829",
            "0.696": "1/79",
            "0.697": "415",
            "0.698": "1661",
            "0.699": "1/631",
            "0.700": "13",
            "0.701": "1/315",
            "0.702": "833",
            "0.703": "1/629",
            "0.704": "417",
            "0.705": "1/157",
            "0.706": "835",
            "0.707": "209",
            "0.708": "1/627",
            "0.709": "837",
            "0.710": "1/313",
            "0.711": "419",
            "0.712": "1/625",
            "0.713": "839",
            "0.714": "105",
            "0.715": "1/39",
            "0.716": "841",
            "0.717": "1/623",
            "0.718": "421",
            "0.719": "1/311",
            "0.720": "1/1243",
            "0.721": "211",
            "0.722": "1/621",
            "0.723": "845",
            "0.724": "1/155",
            "0.725": "423",
            "0.726": "1/619",
            "0.727": "1/1237",
            "0.728": "53",
            "0.729": "1/309",
            "0.730": "849",
            "0.731": "425",
            "0.732": "1/1233",
            "0.733": "1/77",
            "0.734": "1/1231",
            "0.735": "213",
            "0.736": "1/615",
            "0.737": "1/1229",
            "0.738": "1/307",
            "0.739": "1/1227",
            "0.740": "1/613",
            "0.741": "107",
            "0.742": "1713",
            "0.743": "1/153",
            "0.744": "1/1223",
            "0.745": "429",
            "0.746": "1/1221",
            "0.747": "1/305",
            "0.748": "215",
            "0.749": "1/1219",
            "0.750": "1/609",
            "0.751": "1/1217",
            "0.752": "1/19",
            "0.753": "863",
            "0.754": "1/607",
            "0.755": "27",
            "0.756": "1/1213",
            "0.757": "1/303",
            "0.758": "433",
            "0.759": "1/605",
            "0.760": "867",
            "0.761": "1735",
            "0.762": "1/151",
            "0.763": "869",
            "0.764": "1/603",
            "0.765": "435",
            "0.766": "1/301",
            "0.767": "871",
            "0.768": "109",
            "0.769": "1/601",
            "0.770": "873",
            "0.771": "1/75",
            "0.772": "1/1199",
            "0.773": "875",
            "0.774": "1/599",
            "0.775": "219",
            "0.776": "1/299",
            "0.777": "1/1195",
            "0.778": "439",
            "0.779": "1757",
            "0.780": "879",
            "0.781": "55",
            "0.782": "1/1191",
            "0.783": "1/595",
            "0.784": "1/1189",
            "0.785": "441",
            "0.786": "1/297",
            "0.787": "1/1187",
            "0.788": "221",
            "0.789": "1/1185",
            "0.790": "885",
            "0.791": "1/37",
            "0.792": "1/1183",
            "0.793": "1/591",
            "0.794": "111",
            "0.795": "1/295",
            "0.796": "889",
            "0.797": "1/1179",
            "0.798": "445",
            "0.799": "891",
            "0.800": "1/147",
            "0.801": "223",
            "0.802": "1/1175",
            "0.803": "1/587",
            "0.804": "447",
            "0.805": "1/293",
            "0.806": "895",
            "0.807": "7",
            "0.808": "1/585",
            "0.809": "897",
            "0.810": "1/73",
            "0.811": "449",
            "0.812": "899",
            "0.813": "1/583",
            "0.814": "225",
            "0.815": "1/291",
            "0.816": "1/1163",
            "0.817": "451",
            "0.818": "1/581",
            "0.819": "903",
            "0.820": "113",
            "0.821": "1/1159",
            "0.822": "905",
            "0.823": "453",
            "0.824": "1/1157",
            "0.825": "1/289",
            "0.826": "1/1155",
            "0.827": "227",
            "0.828": "1/577",
            "0.829": "1/1153",
            "0.830": "1/9",
            "0.831": "911",
            "0.832": "1823",
            "0.833": "57",
            "0.834": "913",
            "0.835": "1/287",
            "0.836": "457",
            "0.837": "1829",
            "0.838": "1/573",
            "0.839": "229",
            "0.840": "1/143",
            "0.841": "917",
            "0.842": "459",
            "0.843": "1/571",
            "0.844": "919",
            "0.845": "115",
            "0.846": "1/1139",
            "0.847": "921",
            "0.848": "1/569",
            "0.849": "461",
            "0.850": "1/71",
            "0.851": "1847",
            "0.852": "231",
            "0.853": "1/567",
            "0.854": "1/1133",
            "0.855": "1/283",
            "0.856": "927",
            "0.857": "1/1131",
            "0.858": "29",
            "0.859": "1/1129",
            "0.860": "1/141",
            "0.861": "465",
            "0.862": "1/1127",
            "0.863": "1/563",
            "0.864": "233",
            "0.865": "1865",
            "0.866": "1/281",
            "0.867": "467",
            "0.868": "1/561",
            "0.869": "935",
            "0.870": "117",
            "0.871": "1/35",
            "0.872": "937",
            "0.873": "469",
            "0.874": "1877",
            "0.875": "939",
            "0.876": "1/279",
            "0.877": "235",
            "0.878": "1/557",
            "0.879": "1883",
            "0.880": "471",
            "0.881": "1/139",
            "0.882": "1/1111",
            "0.883": "59",
            "0.884": "1/555",
            "0.885": "1/1109",
            "0.886": "1/277",
            "0.887": "947",
            "0.888": "1/1107",
            "0.889": "237",
            "0.890": "949",
            "0.891": "1/69",
            "0.892": "475",
            "0.893": "951",
            "0.894": "1/551",
            "0.895": "119",
            "0.896": "953",
            "0.897": "1/275",
            "0.898": "477",
            "0.899": "1/549",
            "0.900": "1911",
            "0.901": "239",
            "0.902": "1/137",
            "0.903": "1/1095",
            "0.904": "479",
            "0.905": "1/547",
            "0.906": "1/1093",
            "0.907": "15",
            "0.908": "961",
            "0.909": "1/1091",
            "0.910": "481",
            "0.911": "963",
            "0.912": "1927",
            "0.913": "1/17",
            "0.914": "965",
            "0.915": "1/543",
            "0.916": "483",
            "0.917": "967",
            "0.918": "1/271",
            "0.919": "121",
            "0.920": "969",
            "0.921": "1/541",
            "0.922": "485",
            "0.923": "1/135",
            "0.924": "1943",
            "0.925": "243",
            "0.926": "1/539",
            "0.927": "1/1077",
            "0.928": "487",
            "0.929": "1/269",
            "0.930": "1/1075",
            "0.931": "61",
            "0.932": "977",
            "0.933": "1/1073",
            "0.934": "1/67",
            "0.935": "979",
            "0.936": "1959",
            "0.937": "245",
            "0.938": "981",
            "0.939": "1/267",
            "0.940": "491",
            "0.941": "983",
            "0.942": "1/533",
            "0.943": "123",
            "0.944": "985",
            "0.945": "1/133",
            "0.946": "1/1063",
            "0.947": "1/531",
            "0.948": "247",
            "0.949": "1/1061",
            "0.950": "1/265",
            "0.951": "495",
            "0.952": "1/1059",
            "0.953": "1/529",
            "0.954": "31",
            "0.955": "1985",
            "0.956": "1/33",
            "0.957": "497",
            "0.958": "1/527",
            "0.959": "995",
            "0.960": "249",
            "0.961": "1/263",
            "0.962": "1/1051",
            "0.963": "499",
            "0.964": "1/525",
            "0.965": "1/1049",
            "0.966": "125",
            "0.967": "1/131",
            "0.968": "1/1047",
            "0.969": "501",
            "0.970": "1003",
            "0.971": "1/1045",
            "0.972": "251",
            "0.973": "1005",
            "0.974": "503",
            "0.975": "1/521",
            "0.976": "1007",
            "0.977": "63",
            "0.978": "1/65",
            "0.979": "1009",
            "0.980": "505",
            "0.981": "2021",
            "0.982": "1011",
            "0.983": "253",
            "0.984": "1013",
            "0.985": "1/1035",
            "0.986": "507",
            "0.987": "1015",
            "0.988": "2031",
            "0.989": "127",
            "0.990": "1017",
            "0.991": "2035",
            "0.992": "509",
            "0.993": "1019",
            "0.994": "255",
            "0.995": "2041",
            "0.996": "1021",
            "0.997": "511",
            "0.998": "2045",
            "0.999": "1023",
            "1.000": "1/1",
        ]

        let dFms = "%.3f"
        let key = String(format: dFms, pitch)
        if let harmonic = harmonics[key] {
            return harmonic
        } else {
            AKLog("error approximating harmonic")
            return "0"
        }
    }
}

/*
 # Python code to create dictionary:
 haDeDup = {}
 for i in range(1,3072):
    # harmonic
    p2p = np.log2(i) % 1
    p2pk = str("{0:.3f}".format(p2p))
    if p2pk not in haDeDup:
        haDeDup[p2pk] = str(i)

    # subharmonic
    p2pi = 1 - p2p
    p2pik = str("{0:.3f}".format(p2pi))
    if p2pik not in haDeDup:
        haDeDup[p2pik] = str("1/{}".format(i))

 # print in Swift-readable format
 for k in sorted(haDeDup.keys()):
    print("\"{}\": \"{}\", ".format(k,haDeDup[k]))

*/
